const { delete_ti } = require("./api")


  // 设置选项
  const show_option=(that,e)=>{
    let index = e.currentTarget.id
    var ti_id = that.data.list[index].id
    that.setData({
      selected_index:index
    })

    wx.showActionSheet({
      itemList: ['修改','作废'],
      success: res => {
        console.log('tapIndex',res.tapIndex)
        if(res.tapIndex==0){
          wx.navigateTo({
            url: '/pages/sysConfig/config_textBook/edit_ti/edit_ti?ti_id=' + ti_id,
          })
        }else if(res.tapIndex==1){
          wx.showModal({
            content: '确定要作废该题吗？',
            showCancel: true,
            title: '警告',
            success: res => {
              if(res.confirm){
                delete_ti(that, ti_id)
              }
            },
          })
        }
      },
    })

  }



module.exports={
  show_option:show_option,
}